home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
cuj9303.zip
/
1103088A
< prev
next >
Wrap
Text File
|
1993-06-21
|
644b
|
21 lines
#define NUMVAL(x) (x - '0')
#define TONUM(x) NUMVAL(x)
#define TODIGIT(x) (x + '0')
static char trconst[] = {'3', '7', '1', '3',
'7', '1', '3', '7'};
char calc_check_digit (char * trnum)
{
int sum, val;
int i;
for ( sum = i = 0 ; i < 8 ; i++)
{
sum += TONUM (trnum[i]) * TONUM (trconst[i]);
}
val = 10 - (sum % 10);
if (val == 10)
val = 0;
return (TODIGIT (val));
}